<?php
/**
 * Created by mq.
 * User: mq
 * Date: 17-9-1
 * Time: 下午10:08
 */

namespace common\controller;

use think\Controller;
use think\Request;

class Base extends Controller
{

    function _initialize()
    {
//        $request = Request::instance();
//        $theme = config('template.theme');
//        $tplPath = config('template.view_path');
//
//        $tplPath = $tplPath.($request->isMobile() ? 'mobile':'pc').DS.$theme;
//
//        config('template.view_path',$tplPath);

    }

    function fetch($template = '', $vars = [], $replace = [], $config = [])
    {
        if(!$template) {
            $request = Request::instance();
            $action = $request->action();
            $controller = strtolower($request->controller());
            //$viewSuffix = config('template.view_suffix');
            $request = Request::instance();
            $theme = config('template.theme');
            //($request->isMobile() ? 'mobile' : 'pc')
            $template = 'pc'. DS . $theme . DS . $controller . DS . $action ;//. '.' . $viewSuffix;
        }

        return $this->view->fetch($template, $vars, $replace, $config);
    }

}